package com.qingfeng.qfcms.dao.impl;

import com.qingfeng.qfcms.dao.UserDao;
import com.qingfeng.qfcms.domin.User;
import com.qingfeng.qfcms.page.Page;
import com.qingfeng.qfcms.utils.PageData;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * Created by User on 2016/7/20.
 */
@Repository
public class UserDaoImpl extends BaseDaoImpl<User> implements UserDao {


    public UserDaoImpl(){
        this.setNs("com.qingfeng.qfcms.mapper.UserMapper");
    }

    public List<User> checkName(String name) {
        List user=this.getSqlSession().selectList(super.getNs()+".getName",name);
        return user;
    }

    public List<User> findPageList(Page page) {

        List user=this.getSqlSession().selectList(super.getNs()+".findPageList",page);
        return user;
    }

    public List<User> findUserRoleOrganizationList(Page page) {
        List user=this.getSqlSession().selectList(super.getNs()+".UserRoleOrganizationfindPage",page);

        return user;
    }

    public User findById(String id) {
        return (User) this.getSqlSession().selectList(super.getNs()+".findById",id).get(0);
    }

    public int updateIp(User user) {
        return this.getSqlSession().update(super.getNs()+".updateIp",user);
    }

    public List<PageData> findPd(PageData pd) {
        return this.getSqlSession().selectList(super.getNs()+".listAllUser",pd);
    }

}
